/*
 * @Author: january.cjy 
 * @Date: 2021-09-27 16:54:26 
 * @Last Modified by:   january.cjy 
 * @Last Modified time: 2021-09-27 16:54:26 
 */
#include <util.h>

namespace util{
    using namespace std;
    
    string& join(vector<string> input,char x){
        int n=input.size();
        string output="";
        if(n==0) return output;

        output+=input[0];
        for(int i=1;i<n;i++){
            output.push_back(x);
            output+=input[i];
        }
        return output;
    }

    vector<string>&  split(string& input,char x){
        vector<string> output;
        int n=input.size();
        int prev=0;
        for(int i=0;i<n;i++){
            if(input[i]==x){
                output.emplace_back(input.substr(prev,i-prev-1));
                prev=i+1;
            }
        }
        if(prev<n){
            output.emplace_back(input.substr(prev,n-prev));
        }
        return output;
    }
};